package org.dromara.system.utils;

import jodd.util.StringUtil;
import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum ItemBagFieldEnum {

    FIELD1("subStandardId","分标编号"),
    FIELD2("subStandardName","分标名称"),
    FIELD3("bagId","包号"),
    FIELD4("bagName","包名称"),
    FIELD401("bagName","包名称（采购项目名称）"),
    FIELD5("highestPrice","最高限价"),
    FIELD501("highestPrice","采购金额(万元)（含税最高限价）"),
    FIELD6("provincePurchaseRequisitionNumber","网省采购申请号");

    private final String field;
    private final String fieldName;

    public static ItemBagFieldEnum findByFieldName(String fieldName) {
        if (StringUtil.isBlank(fieldName)) {
            return null;
        }
        for (ItemBagFieldEnum type : values()) {
            if (type.fieldName.equals(fieldName.replaceAll("\\s*|\r|\n|\t",""))) {
                return type;
            }
        }
        return null;
    }

}
